package com.easyjava.bean;

import com.easyjava.utils.PropertiesUtils;

/**
 * @projectName: easyjava
 * @author: Li
 * @description:
 */

public class Constants {
    //是否忽略表前缀
    public static Boolean IGNORE_TABLE_PREFIX;
    //参数bean后缀
    public static String SUFFIX_BEAN_QUERY;
    public static String SUFFIX_SERVICE;
    //需要忽略的属性
    public static String IGNORE_BEAN_TOJSON_FILED;
    public static String IGNORE_BEAN_TOJSON_EXPRESSION;
    public static String IGNORE_BEAN_TOJSON_CLASS;
    //日期序列化
    public static String BEAN_DATE_FORMAT_EXPRESSION;
    public static String BEAN_DATE_FORMAT_CLASS;
    //日期反序列化
    public static String BEAN_DATE_UNFORMAT_EXPRESSION;
    public static String BEAN_DATE_UNFORMAT_CLASS;
    //参数模糊搜索后缀
    public static String SUFFIX_BEAN_QUERY_FUZZY;
    //参数日期起止
    public static String SUFFIX_BEAN_QUERY_TIME_END;
    public static String SUFFIX_BEAN_QUERY_TIME_START;
    //Mapper后缀
    public static String SUFFIX_MAPPERS;

    private static String PATH_JAVA = "java";

    private static String PATH_RESOURCES = "resources";

    public static String PATH_BASE;

    public static String PATH_PO;

    public static String PATH_VO;

    public static String PATH_UTILS;

    public static String PATH_ENUMS;

    public static String PATH_QUERY;

    public static String PATH_MAPPERS;

    public static String PATH_MAPPERS_XML;

    public static String PATH_SERVICE;

    public static String PATH_SERVICE_IMPL;

    public static String PATH_EXCEPTION;

    public static String PATH_CONTROLLER;

    public static String PACKAGE_BASE;

    public static String PACKAGE_PO;

    public static String PACKAGE_VO;

    public static String PACKAGE_UTILS;

    public static String PACKAGE_ENUMS;

    public static String PACKAGE_QUERY;

    public static String PACKAGE_MAPPERS;

    public static String PACKAGE_SERVICE;

    public static String PACKAGE_SERVICE_IMPL;

    public static String PACKAGE_EXCEPTION;

    public static String PACKAGE_CONTROLLER;

    public static String SPLIT_TABLE_NAME;


    static {
        IGNORE_TABLE_PREFIX = Boolean.valueOf(PropertiesUtils.getString("ignore.table.prefix"));

        SUFFIX_BEAN_QUERY = PropertiesUtils.getString("suffix.bean.query");
        SUFFIX_SERVICE = PropertiesUtils.getString("suffix.bean.service");

        //需要忽略的属性
        IGNORE_BEAN_TOJSON_FILED = PropertiesUtils.getString("ignore.bean.tojson.filed");
        IGNORE_BEAN_TOJSON_EXPRESSION = PropertiesUtils.getString("ignore.bean.tojson.expression");
        IGNORE_BEAN_TOJSON_CLASS = PropertiesUtils.getString("ignore.bean.tojson.class");
        //日期序列化
        BEAN_DATE_FORMAT_EXPRESSION = PropertiesUtils.getString("bean.date.format.expression");
        BEAN_DATE_FORMAT_CLASS = PropertiesUtils.getString("bean.date.format.class");
        //日期反序列化
        BEAN_DATE_UNFORMAT_EXPRESSION = PropertiesUtils.getString("bean.date.unformat.expression");
        BEAN_DATE_UNFORMAT_CLASS = PropertiesUtils.getString("bean.date.unformat.class");
        //参数模糊搜索后缀
        SUFFIX_BEAN_QUERY_FUZZY = PropertiesUtils.getString("suffix.bean.query.fuzzy");
        //参数日期起止
        SUFFIX_BEAN_QUERY_TIME_END = PropertiesUtils.getString("suffix.bean.query.time.end");
        SUFFIX_BEAN_QUERY_TIME_START = PropertiesUtils.getString("suffix.bean.query.time.start");
        //Mapper后缀
        SUFFIX_MAPPERS = PropertiesUtils.getString("suffix.mappers");

        //包路径
        PACKAGE_BASE = PropertiesUtils.getString("package.base");
        //PO com.easyjava.entity.po
        PACKAGE_PO = PACKAGE_BASE + "." + PropertiesUtils.getString("package.po");
        //VO com.easyjava.entity.vo
        PACKAGE_VO = PACKAGE_BASE + "." + PropertiesUtils.getString("package.vo");
        //工具类 com.easyjava.utils
        PACKAGE_UTILS = PACKAGE_BASE + "." + PropertiesUtils.getString("package.utils");
        //枚举类 com.easyjava.enums
        PACKAGE_ENUMS = PACKAGE_BASE + "." + PropertiesUtils.getString("package.enums");
        //查询类 com.easyjava.query
        PACKAGE_QUERY = PACKAGE_BASE + "." + PropertiesUtils.getString("package.query");
        //Mappers com.easyjava.mappers
        PACKAGE_MAPPERS = PACKAGE_BASE + "." + PropertiesUtils.getString("package.mappers");
        //Service com.easyjava.service
        PACKAGE_SERVICE = PACKAGE_BASE + "." + PropertiesUtils.getString("package.service");
        //ServiceImpl com.easyjava.service.impl
        PACKAGE_SERVICE_IMPL = PACKAGE_BASE + "." + PropertiesUtils.getString("package.service.impl");
        //异常类 com.easyjava.exception
        PACKAGE_EXCEPTION = PACKAGE_BASE + "." + PropertiesUtils.getString("package.exception");
        //Controller com.easyjava.controller
        PACKAGE_CONTROLLER = PACKAGE_BASE + "." + PropertiesUtils.getString("package.controller");


        PATH_BASE = PropertiesUtils.getString("path.base");
        PATH_BASE = PATH_BASE + PATH_JAVA; // D:/work-space/easyjava/easyJava-demo/src/main/java
        //全路径
        PATH_PO = PATH_BASE + "/" + PACKAGE_PO.replace(".", "/");
        PATH_VO = PATH_BASE + "/" + PACKAGE_VO.replace(".", "/");
        PATH_UTILS = PATH_BASE + "/" + PACKAGE_UTILS.replace(".", "/");
        PATH_ENUMS = PATH_BASE + "/" + PACKAGE_ENUMS.replace(".", "/");
        PATH_QUERY = PATH_BASE + "/" + PACKAGE_QUERY.replace(".", "/");
        PATH_MAPPERS = PATH_BASE + "/" + PACKAGE_MAPPERS.replace(".", "/");
        PATH_MAPPERS_XML = PropertiesUtils.getString("path.base") + PATH_RESOURCES + "/" + PACKAGE_MAPPERS.replace(".", "/");
        PATH_SERVICE = PATH_BASE + "/" + PACKAGE_SERVICE.replace(".", "/");
        PATH_SERVICE_IMPL = PATH_BASE + "/" + PACKAGE_SERVICE_IMPL.replace(".", "/");
        PATH_EXCEPTION = PATH_BASE + "/" + PACKAGE_EXCEPTION.replace(".", "/");
        PATH_CONTROLLER = PATH_BASE + "/" + PACKAGE_CONTROLLER.replace(".", "/");
        // 分表
        SPLIT_TABLE_NAME = PropertiesUtils.getString("split.table.name");
    }

    public final static String[] SQL_DATE_TIME_TYPES = new String[]{"datetime", "timestamp"};

    public final static String[] SQL_DATE_TYPES = new String[]{"date"};

    public final static String[] SQL_DECIMAL_TYPES = new String[]{"decimal", "double", "float"};

    public final static String[] SQL_STRING_TYPES = new String[]{"char", "varchar", "text", "mediumtext", "inttext"};

    public final static String[] SQL_INTEGER_TYPES = new String[]{"int", "tinyint"};

    public final static String[] SQL_LONG_TYPES = new String[]{"bigint"};


    public static void main(String[] args) {
        System.out.println(PATH_MAPPERS_XML);
    }
}
